package com.broad.commerce.code.common;

import org.apache.commons.io.filefilter.AbstractFileFilter;
import org.apache.commons.io.filefilter.IOFileFilter;

import java.io.File;
import java.io.Serializable;

/**
 * @author stephen
 * @version V1.0
 * @date 2022-04-17 11:06
 * @description: NotDotFileFilter
 **/
public class NotDotFileFilter extends AbstractFileFilter implements Serializable {

	public static final IOFileFilter INSTANCE = new NotDotFileFilter();
	private static final long serialVersionUID = 4711319841520125497L;

	/**
	 * Restrictive constructor.
	 */
	protected NotDotFileFilter() {
	}

	/**
	 * Checks to see if the file is a file.
	 * @param file the File to check
	 * @return true if the file is a file
	 */
	@Override
	public boolean accept(final File file) {
		return !file.getName().startsWith(".") && file.isFile();
	}
}
